Skip to content

Conversation

@PeraSite
Copy link
Member

Summary

ApiResultCall에서 소켓 오류, DNS 등 네트워크 오류가 발생했을 때 NetworkErrorEventBus로 이 문제를 알려줍니다.

IntroActivity가 이 NetworkErrorEventBus에 구독해 문제가 발생하면 ServerErrorActivity로 넘어갑니다.

근데 IntroViewModel의 기존 흐름인 autoLogin() 에서 명시적인 health check 결과 검증 후 흐름을 끊지 않으면 getAccessTokenUseCase()가 empty를 반환해서 LoginActivity로 넘어갑니다.

ServerErrorActivity로 갔는데도 LoginActivity가 더 늦게 이동되어서 로그인 창이 뜨는걸 방지하려고 작성했던 기존 코드를 개선합니다.

Describe your changes

Issue

  • Resolves #

To reviewers

@PeraSite PeraSite self-assigned this Nov 16, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @PeraSite, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 풀 리퀘스트는 앱의 초기 진입점인 IntroActivity에서 네트워크 오류를 처리하는 방식을 리팩토링하여 경쟁 조건을 해결합니다. 기존 로직에서는 네트워크 연결 문제 발생 시 서버 오류 화면과 로그인 화면이 동시에 나타날 수 있는 혼란스러운 상황이 발생할 수 있었습니다. 이번 변경을 통해 초기 헬스 체크 과정에서 네트워크 오류가 감지되면, 앱은 일관되게 ServerErrorActivity로 이동하며 불필요하게 LoginActivity가 표시되는 것을 방지합니다.

Highlights

  • 경쟁 조건(Race Condition) 개선: IntroActivity의 초기 로딩 과정에서 발생할 수 있는 네트워크 오류 처리 로직의 경쟁 조건을 개선합니다.
  • 일관된 오류 화면 전환: 기존에는 네트워크 오류 발생 시 NetworkErrorEventBus를 통해 ServerErrorActivity로 이동했지만, IntroViewModel의 autoLogin() 흐름이 명시적으로 중단되지 않으면 LoginActivity로 넘어가는 문제가 있었습니다. 이 PR은 ServerErrorActivity로 이동한 후 LoginActivity가 뒤늦게 나타나는 현상을 방지하여 사용자 경험의 일관성을 확보합니다.
  • 명시적인 오류 상태 처리: HealthCheckUseCase 실패 시 IntroViewModel에서 UiState를 IntroState.ServerError로 명시적으로 설정하여 IntroActivity가 올바른 오류 화면으로 전환되도록 합니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

IntroActivity에서 발생하는 레이스 컨디션을 해결하기 위해 네트워크 오류 처리 방식을 리팩토링하는 PR이네요. 기존에는 NetworkErrorEventBus를 사용하여 부수 효과(side effect)에 의존하여 ServerErrorActivity로 이동했는데, 이로 인해 LoginActivityServerErrorActivity 위에 표시되는 문제가 발생할 수 있었습니다. 이번 변경을 통해 IntroViewModel 내에서 명시적인 상태(ServerError)를 관리하도록 수정하여, UI 상태를 단일 진실 공급원(single source of truth)으로 만들어 코드의 안정성과 예측 가능성을 높였습니다. 전반적으로 좋은 리팩토링이라고 생각합니다. IntroActivity의 코드 간결성을 높이기 위한 작은 제안이 하나 있습니다.

Comment on lines 44 to 56
is UiState.Success -> {
startActivity<MainActivity>()
finish()
when (state.data) {
IntroState.ValidToken -> {
startActivity<MainActivity>()
finish()
}

IntroState.ServerError -> {
startActivity<ServerErrorActivity>()
finish()
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

UiState.Success 상태를 처리하는 블록 내에서 finish() 호출이 중복되고 있습니다. finish()when 표현식 밖으로 빼내어 코드를 더 간결하게 만들 수 있습니다.

                    is UiState.Success -> {
                        when (state.data) {
                            IntroState.ValidToken -> startActivity<MainActivity>()
                            IntroState.ServerError -> startActivity<ServerErrorActivity>()
                        }
                        finish()
                    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants